<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Withdrawals extends Model
{   
    protected $table = 'withdrawals';
    //
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'user_id',
        'real_name',
        'idcard',
        'bank_name',
        'card_number',
        'province',
        'city',
        'area',
        'address',
        'accounts_bank',
        'money',
        'fee',
        'partner_trade_no',
        'payment_no',
        'payment_time',
        'note',
        'type',
        'status',
    ];

    public function status(){
        $status = ['未处理','已处理','已退回'];
        return $status[$this->status];
    }

    public function type(){
        $types = ['未处理','银行转账','企业付款'];
        return $types[$this->type];
    }

    public function statuslabel(){
        $status = ['label-danger','label-success','label-primary '];
        return $status[$this->status];
    }

    public function user(){
        return $this->belongsTo('App\User');
    }

}
